var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("fun"),
    i = t("fightManager"),
    s = cc._decorator,
    c = s.ccclass,
    l = s.property,
    u = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.jt = null), (e.dis = 100), (e.selfy = 100), e;
        }
        return (
            n(e, t),
            (e.prototype.lateUpdate = function () {
                var t = i.default.inst;
                if (null != t) {
                    var e = t.camera.node.parent.getComponent(cc.Component),
                        o = a.getDisEnemy(e, t.enemy.enemys);
                    if (null == o) this.jt.active = !1;
                    else {
                        var n = Math.abs(o.node.x - e.node.x),
                            r = Math.abs(o.node.y - e.node.y),
                            s = this.node.parent.width / 2,
                            c = this.node.parent.height / 2;
                        if (n > s || r > c) {
                            this.jt.active = !0;
                            var l = t.player.node.x,
                                u = t.player.node.y + this.selfy,
                                p = o.node.x,
                                f = o.node.y + this.selfy,
                                d = l - e.node.x,
                                h = u - e.node.y,
                                y = p - l,
                                g = f - u,
                                v = Math.atan2(g, y),
                                m = Math.cos(v),
                                _ = Math.sin(v);
                            (this.jt.x = m * this.dis + d),
                                (this.jt.y = _ * this.dis + h),
                                (this.jt.angle = v / (Math.PI / 180));
                        } else this.jt.active = !1;
                    }
                }
            }),
            r([l(cc.Node)], e.prototype, "jt", void 0),
            r([l()], e.prototype, "dis", void 0),
            (e = r([c], e))
        );
    })(cc.Component);
o.default = u;
